-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use the obj role for all See Also items #8051
Conversation
the changes I just pushed will try to apply |
I agree this is an incorrect approach. +1 for changing this behavior. I don't know why the original code chooses a role from But it's too much to access the internal data structure of intersphinx directly. I think it is better to use |
that does work and is indeed simpler. However, |
Surely. But I doubt that all items in "see also" field for methods (or functions) always refer to methods (or functions). So it would be better to use My main concern is such change is an incompatible change or not. @shimizukawa do you have an opinion? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems @shimizukawa has been busy. Okay, let's merge this.
@@ -1151,6 +1151,41 @@ def push_item(name: str, rest: List[str]) -> None: | |||
items.append((name, list(rest), role)) | |||
del rest[:] | |||
|
|||
def search_inventory(inventory, name, hint=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is no longer needed now.
else: | ||
link = "`%s`_" % func | ||
link = ':%s:`%s`' % (func_role, func) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems func_role
would not be changed. How about embedding it into the format-string?
I'll update this code after merging. |
Merged. Thank you for your contribution! |
Feature or Bugfix
Purpose
Before this change,
napoleon
would look forSee Also
items using the same role as the documented object. This breaks once one tries to link to other kinds of objects, e.g. from a function to a method.With the proposed changes, the code parsing
See Also
sections will try to find the correct role for a referenced object from the intersphinx inventory.Relates